<template>
	<view class="content">
		<view class="info lend">
			<view class="item2" v-for="(item,i) in list">
				<!-- <image :src="require(`@/static/img/${item.img}`)" mode="widthFix"></image> -->
				<image :src="item.icon" mode="widthFix"></image>
				<view class="text">
					<view>{{item.type_name}}</view>
					<view>{{item.file_tip}}</view>
				</view>
				<view class="btn clo_1" v-if="item.is_upload==0" @click="to(item.url)">立即上传</view>
				<view class="btn clo_2" v-if="item.is_upload==1&&item.passed==0" @click="to(item.url)">等待审核</view>
				<view class="btn clo_3" v-if="item.is_upload==1&&item.passed==1" @click="to(item.url)">已上传</view>
				<view class="btn clo_4" v-if="item.is_upload==1&&item.passed==2" @click="to(item.url)">审核失败</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		userRenz
	} from "@/common/js/index.js"
	export default {
		data() {
			return {
				list: [{
						img: "audit_icon1.png",
						title: "实名认证",
						text: "验证身份信息",
						url: '/pages/authentication/autonym'

					},
					{
						img: "audit_icon2.png",
						title: "工作认证",
						text: "验证真实工作信息",
						url: '/pages/authentication/work'
					},
					{
						img: "audit_icon3.png",
						title: "信用报告",
						text: "验证个人征信信息",
						url: '/pages/authentication/credit'
					},
					{
						img: "audit_icon4.png",
						title: "收入认证",
						text: "评估还款能力",
						url: '/pages/authentication/income'
					},
					{
						img: "audit_icon5.png",
						title: "房产认证",
						text: "评估资产与还款能力",
						url: '/pages/authentication/house'
					},
					{
						img: "audit_icon6.png",
						title: "手机实名认证",
						text: "验证个人真实信息",
						url: '/pages/authentication/phone'
					},
				],
				id: '',
				userId: '',
			}
		},
		onLoad(e) {
			console.log(e);
			if(e.id) {
				this.id = e.id
				this.userId = e.id
				uni.setNavigationBarTitle({
					title: e.name+ '认证信息'
				});
			}
		},
		onShow() {
			this.select()
		},
		methods: {
			select() {
				var data
				if(this.id) {
					data = {user_id: this.id}
				}
				userRenz(data).then(res => {
					console.log(res);
					var list = res.data.list
					for (var i = 0; i < list.length; i++) {
						var url
						var info = JSON.stringify(list[i])
						// var info = this.userId
						if (list[i].id == 1) url = '/pages/authentication/autonym?info=' + info+'&id='+this.userId
						if (list[i].id == 2) url = '/pages/authentication/work?info=' + info+'&id='+this.userId
						if (list[i].id == 3) url = '/pages/authentication/credit?info=' + info+'&id='+this.userId
						if (list[i].id == 4) url = '/pages/authentication/income?info=' + info+'&id='+this.userId
						if (list[i].id == 6) url = '/pages/authentication/house?info=' + info+'&id='+this.userId
						if (list[i].id == 11) url = '/pages/authentication/phone?info=' + info+'&id='+this.userId
						if (list[i].id == 16) url = '/pages/authentication/other?info=' + info+'&id='+this.userId
						list[i].url = url
					}
					// this.list1 = list
					this.list = list
				})
			},
			to(e) {
				uni.navigateTo({
					url: e
				})
			}
		},
	}
</script>

<style scoped lang="scss">
	.content {
		/* background: white; */
		position: relative;
		overflow: hidden;
	}

	.info {
		margin: 40rpx 30rpx;
		padding: 0 30rpx 140rpx;
		background-color: white;
		background: #FFFFFF;
		border-radius: 12rpx;
		overflow: hidden;

		.item2 {
			height: 142rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 2rpx solid #EEEEEE;

			image {
				width: 48rpx;
			}

			.text {
				flex: 1;
				margin-left: 16rpx;

				view {
					&:nth-of-type(1) {
						font-size: 28rpx;
					}

					&:nth-of-type(2) {
						font-size: 24rpx;
						color: #999999;
						margin-top: 6rpx;
					}
				}
			}

			.btn {
				width: 136rpx;
				height: 52rpx;
				line-height: 52rpx;
				text-align: center;
				border-radius: 30rpx;
				font-size: 26rpx;
			}
		}
	}

	.clo_1 {
		border: 2rpx solid #FF534E;
		color: #FF534E;
	}
	.clo_2 {
		border: 2rpx solid #509DFC;
		color: #509DFC;
	}
	.clo_3 {
		border: 2rpx solid #56D087;
		color: #56D087;
	}
	.clo_4 {
		border: 2rpx solid #FF9903;
		color: #FF9903;
	}
</style>